package week10;

public class Bear extends Animals{
    private  int age;
    private  int weight;

    public Bear(){

    }

    public Bear(int age, int weight) {
        this.age = age;
        this.weight = weight;
    }

    public Bear(String name, String color, int age, int weight) {
        super(name, color);
        this.age = age;
        this.weight = weight;
    }
    public  void eat(){
        System.out.println(getName() +"要吃花生米");
    }

    public int getAge() {
        return age;
    }

    public int getWeight() {
        return weight;
    }

    @Override
    public String toString() {
        return super.toString()+
                "{age=" + age  +
                ",weight=" + weight +
                '}';

    }

}
class test{
    public static void main(String[] args) {
        final Bear bear = new Bear("维尼","yellow",18,100);
        System.out.println(bear.toString());
        bear.eat();
    }
}